package com.ylr.user.framework.handler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.ylr.base.common.po.user.UserPo;
import com.ylr.base.common.tool.Result;
import com.ylr.user.framework.feign.user.YuUserClient;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-05-08 10:52:07
 * className: UserLogoutHandler
 * version: 1.0
 * description:
 */
@Component
@AllArgsConstructor
public class UserLogoutHandler {

    private static final Logger log = LoggerFactory.getLogger(UserLogoutHandler.class);

    private final YuUserClient yuUserClient;

    @XxlJob("userLogoutHandler")
    public void userLogoutHandler() {
        XxlJobHelper.log("开始清理用户登录过期记录");

        String param = XxlJobHelper.getJobParam();
        log.info("param={}", param);

        Result<UserPo> result = yuUserClient.check("123456", "web", "/api");
        log.info("result={}", result);

        XxlJobHelper.log("清理用户登录过期记录请求发送成功");
    }
}
